<template>
  <el-dialog
    title="物料列表"
    :visible.sync="dialogVisible"
    width="1000px">
    <el-table
      :data="datajson"
      border
      ref="singleTable"
      highlight-current-row
      :header-cell-style="{background:'#17b3a3',color:'#FFFFFF'}"
      v-loading="dataListLoading"
      style="width: 100%;">
      <el-table-column
        prop="mid"
        header-align="center"
        align="center"
        label="物料编号">
      </el-table-column>
      <el-table-column
        prop="mname"
        header-align="center"
        align="center"
        label="物料名称">
      </el-table-column>
      <el-table-column
        prop="mtype"
        header-align="center"
        align="center"
        label="物料类型">
      </el-table-column>
      <el-table-column
        prop="standard"
        header-align="center"
        align="center"
        label="物料执行标准">
      </el-table-column>
      <el-table-column
        prop="description"
        header-align="center"
        align="center"
        label="物料描述">
      </el-table-column>
    </el-table>
  </el-dialog>
</template>

<script>
export default {
  name: 'posmat',
  data(){
    return {
      dataForm: {
        key: ''
      },
      datajson: [],
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      dataListSelections: [],
      addOrUpdateVisible: false,
      Visiable: false,
      dialogVisible:false
    }
  },
  methods:{
    init(pid){
      this.dialogVisible = true;
      console.log('子组件pid为' + pid)
      this.dataForm.key = pid;
      this.$http({
        url: this.$http.adornUrl('/matlist/material/listPileMat'),
        method: 'get',
        async: false,
        params: this.$http.adornParams({
          'pid': this.dataForm.key
        })
      }).then(({data}) => {
        this.datajson = data
        console.log(data)
        this.dataListLoading = false
      })
    }
  }
}
</script>

<style scoped>

</style>
